1. Field of the Invention
This invention relates to a method and device for forming part or a whole of a whole image by converting character codes of characters, such as letters, numerals, and simple figure, to data of character images representative of the characters, based on a predetermined font, and properly arranging the data.
2. Prior Art
Generally, to print or display an image of characters, such as letters, numerals, symbols, simple figures, etc., or a character string formed by arranging the characters, it is required to read out font data corresponding to the text data (character code) of each character from a ROM or the like storing predetermined font data, and then, based on the font data, convert the character code to data representative of a character image and arrange the data of the character image in a predetermined area of a memory, thereby forming print image data or display image data as whole image data representative of the whole image.
As fonts (font data) for converting character codes to data of character images, there have been conventionally employed a dot font in which each character image is represented by a set of pixels (dots) in a manner defined by a dot matrix (bitmap font) of a predetermined size, and an outline font in which each character image is defined by the coordinates of several reference points for forming contour lines of the image, the attributes of lines (straight lines or curves) connecting the reference points to each other, etc.
The dot font provides images of characters fixed in size, and hence to print characters (character images) having various sizes in a clear and attractive manner, it is required to store font data suitable for each of the sizes for use, which necessitates a very large memory capacity. To enlarge each character image, i.e. to form an enlarged image, by using only dot font data of a predetermined size, it is required to replace one image pixel of each original character image by a plurality of image pixels. On the other hand, in forming a reduced image, image pixels have to be thinned.
In these cases, curved portions of the resulting character images are jagged, and to remove jaggedness from them, there is carried out a replacement process, in which blank pixels and image pixels at the curved portions are replaced by each other in a manner adjusted to the original curve such that the curved portion is smoothed. That is, so-called smoothing has to be carried out. However, the smoothing is complicated processing, and it is difficult to form a neater image than an image formed based on the outline font discussed hereafter.
The outline font provides character images each defined by the coordinates and attributes of contour lines thereof. Hence, the dot matrix of a character image having a desired size can be determined simply by converting the character code to image data corresponding thereto according to the desired size. That is, the font data as reference is expanded or reduced in size by calculation during the conversion of the character code, so that a clear enlarged or reduced image can be formed by converting the character code of the original character image and arranging the updated character image according to the expanded or reduced size of the same.
Therefore, when a character image is enlarged or reduced to display or print the same, i.e. when the enlarging/reducing processing of a display image or a print image is required, outline fonts are generally used. Further, display devices and printing apparatuses necessitating the above processing are generally provided with a ROM or the like for storing outline fonts.
However, when character images are displayed or printed, it can be preferable to form a partial image (part of the whole of the character images), e.g. when only part of character images can be displayed due to a limited area of the display screen or limited printing area of the printing object, or when it is desired to intentionally display or print part of the original character image (partial image) by enlarging/reducing the same, or when a combined image is desired to be formed by combining a plurality of character images.
In such cases, when the apparatus employs the conventional enlarging/reducing method, it is required to form a whole image in a dot matrix larger or smaller in size than the original image, and then cut out part of the whole image in the form of a smaller dot matrix. This necessitates an extra capacity of the memory for an unused portion of the whole image. For instance, when a combined image is desired to be formed from portions of a plurality of character images, all of the character images are formed by conversion from their character codes, and a required portion of each character image is extracted and arranged within an area for the combined image. This requires a markedly increased capacity of memory.
This inconvenience imposes limitations on the functions and performance of an inexpensive and small-sized apparatus, such as a tape printing apparatus and a stamp image-forming apparatus, which is provided with a display device and printing device as described above. On the other hand, it is the small-sized apparatus of this kind that requires the function of forming a partial image due to limited area of the display screen and limited printing area of a printing object.
Further, if the original character image is in a dot matrix, to enlarge/reduce part of the same, it is only required to cut out (extract) a required portion from the original character image as data in a dot matrix, and carry out the same enlarging/reducing processing as carried out when the whole image is enlarged/reduced in size.
Therefore, in the case of small-sized apparatuses which makes use of the outline font in normal display or printing, especially when a partial image of an enlarged image is formed, a whole image of each character image which can be displayed by the capacity of memory is formed first, and then cut out (extract) and enlarge part of the whole image. Further, in forming a combined image, the forming of a whole image and extraction of a required portion thereof is executed sequentially on each of all of the character images to store only a required portion of each whole image, so as to reduce the capacity of memory necessitated at one time.
However, in these cases, as described above, the smoothing of a curved portion becomes required. This makes the overall processing complicated, and what is worse, enlarged images and combined images thus produced are less attractive in appearance than when the outline font is utilized.
It is an object of the invention to provide an image-forming method and device which is capable of forming part or a whole of a whole image comprised of at least one character image formed by converting respective character code(s) to image data and arranging the image data, as an attractive image while saving or reducing the capacity of memory.
To attain the above object, according a first aspect of the invention, there is provided a method of forming an image, comprising the steps of:
defining a plurality of conversion modes to be selectively employed for converting character codes to character image data items each representative of a character image based on an outline font, the conversion modes including at least one partial conversion mode for carrying out conversion of each of the character codes such that only a required portion of each of the character image data items corresponding to the each of the character codes is obtained when at least one of at least one fully-converting condition peculiar to each of the conversion modes is not fulfilled in converting the each of the character codes,
setting a selected one of the conversion modes to an actual conversion mode;
setting an image-forming range in a whole image represented by whole image data to be created by converting at least one character code to character image data and arranging the character image data; and
forming partial image data representative of part or a whole of the whole image by conversion of each character code in the actual conversion mode, the each character code belonging to the at least one character code and corresponding to character image data representative of a character image part or a whole of which lies within the image-forming range, and arrangement of image data resulting from the conversion within a predetermined partial image data-forming area.
To attain the object, according to a second aspect of the invention, there is provided an image-forming device comprising:
outline font-storing means for storing an outline font;
conversion mode-defining means for defining a plurality of conversion modes to be selectively employed for converting character codes to character image data items each representative of a character image based on an outline font, the conversion modes including at least one partial conversion mode for carrying out conversion of each of the character codes such that only a required portion of each of the character image data items corresponding to the each of the character codes is obtained when at least one of at least one fully-converting condition peculiar to each of the conversion modes is not fulfilled in converting the each of the character codes;
conversion mode-setting means for setting a selected one of the conversion modes to an actual conversion mode;
image-forming range-setting means for setting an image-forming range in a whole image represented by whole image data to be created by converting at least one character code to character image data and arranging the character image data; and
partial image data-forming means for forming partial image data representative of part or a whole of the whole image by conversion of each character code in the actual conversion mode, the each character code belonging to the at least one character code and corresponding to character image data representative of a character image part or a whole of which lies within the image-forming range, and arrangement of image data resulting from the conversion within a predetermined partial image data-forming area.
According to this image-forming method and device therefor, a partial image can be formed by setting a conversion mode for converting character codes to character images and an image-forming range for forming a partial image, and out of character images to be arranged when a whole image is formed, converting each character code corresponding to each character image part or all of which is within the image-forming range to data representative thereof in the set conversion mode based on an outline font and properly arranging the data. This method employs the outline font (data), and hence it is possible to form an attractive partial image. Further, by setting one of at least one partial conversion modes, only a required portion of each character image can be converted (partially converted) from its character code when the fully-converting conditions including a condition that a whole of the character image is required, are not fulfilled, so that an extra capacity of memory for storing an unrequired portion of the desired image becomes unnecessary, which makes it possible to save or reduce the capacity of memory.
Preferably, the at least one partial conversion mode includes an enlarged image mode in which an enlarged image to be formed by enlarging at least one character image represented by the character image data corresponding respectively to the at least one character code is set to the whole image, the at least one fully-converting condition for the enlarged image mode including a condition that a whole of the enlarged image lies within the image-forming range.
According to this preferred embodiment of each aspect of the invention, the at least one partial conversion mode includes an enlarged image mode, and the fully-converting conditions include a condition that a whole of the enlarged image lies within the image-forming range. In other words, even when the enlarged image mode is employed in which an enlarged image is set to the whole image, if the whole of the enlarged image is not necessary (the fully-converting conditions are not fulfilled), a required portion of the enlarged image can be formed as the partial image. In such a case, according to the method and device of the preferred embodiment, only data of the required portion of each enlarged character image is formed by converting its character code thereto, so that an extra capacity of memory for storing an unrequired portion of an image becomes unnecessary, which makes it possible to save or reduce the capacity of memory.
Preferably, the at least one partial conversion mode includes a partial image mode in which the partial image data is formed as data representative of the part of the whole image, the at least one fully-converting condition for the partial image mode including a condition that a whole of the whole image lies within the image-forming range.
According to this preferred embodiment of each aspect of the invention, a partial image mode can be set for forming part of the whole image as the partial image, and the fully-converting conditions for this mode include a condition that the whole of the whole image lies within the image-forming range. That is, the partial image can be formed only by setting the partial image mode and the image-forming range therefor. In this case, unless the whole of the whole image is set to the image-forming range, the fully-converting conditions are not fulfilled, and hence only data of a required portion of an image of characters is partially converted from respective character codes, so that an extra capacity of memory for storing an unrequired portion of the image becomes unnecessary, which makes it possible to save or reduce the capacity of memory.
Preferably, the step of forming the partial image data includes the steps of:
setting a layout of the part or the whole of the character image represented by the character image data corresponding to the each character code within the image-forming range, the layout including a size of the part or the whole of the character image within the image-forming range and an arrangement area for the part or the whole of the character image within the predetermined partial image data-forming area; and
converting the each character code based on the outline font such that a required portion of the character image data representative of the character image is obtained, when a selected one of the at least one partial conversion mode is set, and arranging the required portion of the character image data in the arrangement area, to thereby form the partial image data within the predetermined partial image data-forming area.
Preferably, the partial image data-forming means includes:
layout-setting means for setting a layout of the part or the whole of the character image represented by the character image data corresponding to the each character code within the image-forming range, the layout including a size of the part or the whole of the character image within the image-forming range and an arrangement area for the part or the whole of the character image within the predetermined partial image data-forming area; and
partial image data conversion/arrangement means for converting the each character code based on the outline font such that a required portion of the character image data representative of the character image is obtained, when a selected one of the at least one partial conversion mode is set, and arranging the required portion of the character image data in the arrangement area, to thereby form the partial image data within the predetermined partial image data-forming area.
According to these preferred embodiments, a layout is set which includes a size of the part or the whole of the character image within the image-forming range and an arrangement area for the part or the whole of the character image within the predetermined partial image data-forming area. Each character code is converted based on the outline font such that a required portion of the character image data representative of the character image is obtained, when a selected one of the at least one partial conversion mode is set. The required portion of the character image data is arranged in the arrangement area. This makes it possible to form data of an attractive partial image within the predetermined partial image data-forming area. Further, by partially converting character codes to obtain only the required portion of the character image, it is possible to save or reduce the capacity of memory.
More preferably, the at least one fully-converting condition for the selected one of the at least one partial conversion mode includes a condition that as to the each character code, a whole of the character image data corresponding to the each character code is required to form the partial image data, and at the same time, the whole of the character image data can be arranged within the arrangement area.
According to this preferred embodiment of each aspect of the invention, when the whole of a character image is not required in forming the partial image, or when the whole of the character image cannot be arranged in the arrangement area, the fully-converting conditions are not fulfilled. When these fully-converting conditions are not fulfilled, the full conversion of character codes corresponding to the character images is wasteful, and by the partial conversion to form the required portion of the character images, it is possible to save or reduce the capacity of memory.
More preferably, the step of converting the each character code such that a required portion of the character image data representative of the character image is obtained, and arranging the required portion in the arrangement area includes the step of converting a single character code such that a required portion of character image data corresponding to the single character code is obtained, and directly arranging the required portion of the character image data within the arrangement area.
More preferably, the partial image data conversion/arrangement means includes partial conversion means for converting a single character code such that a required portion of character image data corresponding to the single character code is obtained, and directly arranging the required portion of the character image data within the arrangement area.
According to these preferred embodiments, data of only the required portion of character image is formed by conversion of the single character code to image data and direct arrangement of the image data within the arrangement area. This makes it possible to save or reduce the capacity of memory, and by repeating the above process by the number of times corresponding to the number of characters, the partial image can be formed.
More preferably, the partial image data-forming area contains a conversion area allocated for converting a single character code to character image data corresponding to the single character code and storing the character image data corresponding to the single character code therein;
the step of converting the each character code such that a required portion of the character image data representative of the character image is obtained, and arranging the required portion in the arrangement area includes the steps of:
converting the single character code such that a required portion of character image data corresponding to the single character code is obtained, and storing the required portion of the character image data corresponding to the single character code, in the conversion area; and
arranging the required portion of the character image data stored in the conversion area, within the arrangement area.
More preferably, the partial image data-forming area contains a conversion area allocated for converting a single character code to character image data corresponding to the single character code and storing the character image data corresponding to the single character code therein;
the partial image data conversion/arrangement means includes:
partial conversion means for converting the single character code such that a required portion of character image data corresponding to the single character code is obtained, and storing the required portion of the character image data corresponding to the single character code, in the conversion area; and
character image data arrangement means for arranging the required portion of the character image data stored in the conversion area within the arrangement area.
According to these preferred embodiments, each single character code corresponding to the required portion of the character image is converted to image data, and the image data is arranged in the arrangement area. By repeating the above process by the number of times equal to the number of characters, data representative of the partial image can be formed.
Further preferably, the at least one fully-converting condition for the selected one of the at least one partial conversion mode includes a condition that the each character code can be converted such that a whole of the character image data representative of the character image corresponding to the each character code can be stored in the conversion area.
According to this preferred embodiment of each aspect of the invention, if a character code cannot be converted such that a whole of the character image represented by the character image data corresponding to the each character code can be stored in the conversion area, the fully-converting conditions are not fulfilled, so that by partially converting the character codes to obtain data of the required portions of the character images, the capacity of memory can be saved or reduced. That is, by allocating the conversion area according to the size of the character images, which is frequently employed, it becomes unnecessary to store an extra area only for storing data of enlarged character images which are less frequently used, whereby it is possible to save or reduce the capacity of memory. Further, to store data of character images which are formed by conversion of character codes and exceed in size the conversion area, in the conversion area, it is only required to partially convert the character codes, and this does not occur so often, causing no significant problem to the overall processing speed.
Further preferably, the step of converting a single character code such that a required portion of character image data corresponding to the single character code is obtained, and directly arranging the required portion of the character image data within the arrangement area includes the steps of:
defining a contour line of a whole of a character image represented by character image data to be formed from the single character code, as an imaginary contour line, assuming that the single character code is converted based on the outline font such that the whole of the character image represented by the character image data is obtained;
determining an actual contour line from the imaginary contour line, the actual contour line being part of the imaginary contour line within a partial conversion range defining a required portion of the character image data corresponding to the single character code, and arranging actual contour pixels forming the actual contour line; and
arranging pixels within an area enclosed by the actual contour pixels to thereby form image data constituted by the arranged pixels including the actual contour pixels, as image data to which the single character code is partially converted.
Further preferably, the partial conversion means includes:
imaginary contour line-defining means for defining a contour line of a whole of a character image represented by character image data to be formed from the single character code, as an imaginary contour line, assuming that the single character code is converted based on the outline font such that the whole of the character image represented by the character image data is obtained;
actual contour pixels-arranging means for determining an actual contour line from the imaginary contour line, the actual contour line being part of the imaginary contour line within a partial conversion range defining a required portion of the character image data corresponding to the single character code, and arranging actual contour pixels forming the actual contour line; and
partially-converted image data pixels-arranging means for arranging pixels within an area enclosed by the actual contour pixels to thereby form image data constituted by the arranged pixels including the actual contour pixels, as image data to which the single character code is partially converted.
According to these preferred embodiments, to form data of the required portion of a single character image, the contour line of the whole of a character image to be formed by conversion (full conversion) of the character code based on the outline font is defined as an imaginary contour line, and only a portion of the imaginary contour line within the partial conversion range is determined to be an actual contour line. Then, actual contour pixels forming the actual contour line and pixels within an area enclosed by the actual contour pixels are arranged. Thus, the required portion of the character image can be formed by the partial conversion of the character codes.
Still further preferably, the step of defining the contour line of the whole of the character image represented by the character image data to be formed includes the steps of:
reading data of the outline font corresponding to the single character code; and
converting contour coordinates included in the read data of the outline font to ones adapted to the size of the part or the whole of the character image represented by the character image data corresponding to the single character code within the image-forming range, the size being included in the layout.
Still further preferably, the imaginary contour line-defining means includes:
outline font-reading means for reading data of the outline font corresponding to the single character code; and
contour coordinates conversion means for converting contour coordinates included in the read data of the outline font to ones adapted to the size of the part or the whole of the character image represented by the character image data corresponding to the single character code within the image-forming range, the size being included in the layout.
According to these preferred embodiments, to define the imaginary contour line, data of the outline font corresponding to the single character code is read, and contour coordinates included in the read data of the outline font are converted to ones adapted to the size of the part or the whole of the character having been set in respect of layout. Therefore, the imaginary contour line can be defined by using a contour line formed by the conventional method of converting character codes to character image data.
Still further preferably, the step of determining the actual contour line and arranging the actual contour pixels forming the actual contour line includes the steps of:
calculating coordinates of a position of each of imaginary contour pixels forming the imaginary contour line based on contour coordinates and attributes defining the imaginary contour line;
determining whether or not the coordinates of the position of the each of the imaginary contour pixels are within the partial conversion range; and
arranging each of ones of the imaginary contour pixels, of which the coordinates of the position are determined to be within the partial conversion range, in the position indicated by the coordinates, as the actual contour pixels forming the actual contour line.
Still further preferably, the actual contour pixels-arranging means includes:
imaginary contour pixel position-calculating means for calculating coordinates of a position of each of imaginary contour pixels forming the imaginary contour line based on contour coordinates and attributes defining the imaginary contour line;
actual contour pixel-determining means for determining whether or not the coordinates of the position of the each of the imaginary contour pixels are within the partial conversion range; and
actual contour pixel-arranging means for arranging each of ones of the imaginary contour pixels, of which the coordinates of the position are determined to be within the partial conversion range, in the position indicated by the coordinates, as the actual contour pixels forming the actual contour line.
According to these preferred embodiments, to arrange the actual contour pixels, coordinates indicative of the position of each of imaginary contour line pixels forming the imaginary contour line are calculated based on the contour coordinates and attributes defining the imaginary contour line, and as to each of the pixels, it is determined whether or not coordinates of the position of the each of the imaginary contour pixels are within the partial conversion range. Each of ones of the imaginary contour pixels, of which the coordinates of the position are determined to be within the partial conversion range, is arranged in the position indicated by the coordinates, as the actual contour pixels forming the actual contour line. Therefore, it is possible to arrange the actual contour pixels forming the actual contour line of the partially-converted image of character images.
Preferably, the partial image data is formed as print image data representative of a print image to be printed on a printing object.
According to this preferred embodiment of each aspect of the invention, the partial image data is formed as print image data representative of a print image to be printed on a printing object. Therefore, this embodiment can be applied to a printing apparatus or the like, as the method and device for forming a print image.
Preferably, the printing object is a tape.
According to this preferred embodiment of each aspect of the invention, the printing object on which the partial image formed as the print image is a tape. This makes it possible to apply the method and device according to the embodiment to a tape printing apparatus.
Preferably, the partial image data is formed as display image data representative of a display image to be displayed on a display screen.
According to this preferred embodiment of each aspect of the invention, the partial image is formed as display image data representative of a display image to be displayed on a display screen. Therefore, this embodiment can be applied to a display device or the like as the method and device for forming a display image.